import 'package:flutter/material.dart';
import 'package:jdapp/jj_home_tabs.dart';
import 'package:jdapp/pages/Search.dart';
import 'package:jdapp/pages/ProductList.dart';
import 'package:jdapp/pages/ProductContent.dart';
import 'package:jdapp/pages/Login.dart';
import 'package:jdapp/pages/RegisterFirst.dart';
import 'package:jdapp/pages/RegisterSecond.dart';
import 'package:jdapp/pages/RegisterThird.dart';
import 'package:jdapp/pages/CheckOut.dart';
import 'package:jdapp/pages/Address/AddressAdd.dart';
import 'package:jdapp/pages/Address/AddressEdit.dart';
import 'package:jdapp/pages/Address/AddressList.dart';
import 'package:jdapp/pages/Pay.dart';

final routes = {
  '/': (context)=>Tabs(),
  '/search':(context)=>SearchPage(),
  '/Login':(context)=>LoginPage(),
  '/pay':(context)=>PayPage(),
  '/checkOut':(context)=>CheckOutPage(),
  '/addressAdd':(context)=>AddressAddPage(),
  '/addressList':(context)=>AddressListPage(),
  '/addressEdit':(context)=>AddressEditPage(),
   '/registerFirst':(context)=>RegisterFirstPage(),
   '/registerSecond':(context,{arguments})=>RegisterSecondPage(arguments:arguments),
   '/registerThird':(context,{arguments})=>RegisterThirdPage(arguments:arguments),
  '/productList': (context,{arguments}) => ProductListPage(arguments:arguments),
  '/productContent': (context,{arguments}) => ProductContentPage(arguments:arguments),
};
var onGenerateRoute = (RouteSettings settings) {
  final String? name = settings.name;
  final Function? pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route =MaterialPageRoute(
        builder: (context)=>
          pageContentBuilder(context));
        return route;
        
    }
  }
};
